package client;
import gui.Chat;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.text.AbstractDocument;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;

public class Test
{
	public static void main(String[] arguments)
	{
		new Test();
	}
	
	Chat chat;

	AbstractDocument doc;
	
	SimpleAttributeSet nameFont;
	
	SimpleAttributeSet serverFont;
	
	public Test()
	{
		JFrame frame = new JFrame();
		
		JButton button = new JButton("Stop");
		button.addActionListener(actionListener);
		
		/*textPane = new JTextPane();
		textPane.setCaretPosition(0);
		textPane.setEditable(false);
		textPane.setMargin(new Insets(5, 5, 5, 5));
		doc = (AbstractDocument) textPane.getStyledDocument();
		
		JScrollPane scrollPane = new JScrollPane(textPane, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
		scrollPane.setPreferredSize(new Dimension(200, 200));*/
		
		chat = new Chat();
		
		nameFont = new SimpleAttributeSet();
		StyleConstants.setBold(nameFont, true);
		
		frame.add(chat, BorderLayout.CENTER);
		frame.add(button, BorderLayout.SOUTH);
		
		frame.setSize(600, 340);
		frame.setVisible(true);
		
		new Thread()
		{
			public void run()
			{
				while(true)
				{
					try
					{
						chat.appendLine("Maurits", "Het werkt!");

						Thread.sleep(250);
					}
					catch (Exception e)
					{
						e.printStackTrace();
					}
				}
			}
		}
		.start();
	}
	
	private ActionListener actionListener = new ActionListener()
	{
		public void actionPerformed(ActionEvent e)
		{
		}
	};
}
